package edu.mse.camel.client.whiteboard.gef.ui.properties;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource2;

public abstract class AbstractPropertySource implements IPropertySource2 {

	private Object model;
	private IPropertyDescriptor[] descriptors;
	
	public AbstractPropertySource(Object model) {
		this.model = model;
	}
	
	public abstract void createPropertyDescriptors(List descriptors);
	
	public Object getModel() {
		return model;
	}	

	public Object getEditableValue() {
		return this;
	}

	public IPropertyDescriptor[] getPropertyDescriptors() {
		List list = new ArrayList();
		createPropertyDescriptors(list);
		descriptors = new IPropertyDescriptor[list.size()];
		list.toArray(descriptors);
		return descriptors;
	}
	
	public boolean isPropertySet(Object id) {
		return false;
	}
	
	public boolean isPropertyResettable(Object id) {
		return false;
	}
	
	public void resetPropertyValue(Object id) {}

}
